<template>
    <wd-navbar 
        :title="title" 
        custom-class="navbar-custom" 
        :bordered="false" 
        safeAreaInsetTop
        left-arrow
        @click-left="goBack"
    ></wd-navbar>
    <view class="px-[30rpx] pt-[30rpx] pb-[30rpx]">
        <mp-html :content="content"></mp-html>
    </view>
</template>

<script setup>
import { ref } from 'vue'
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'

definePage({
  style: {
    navigationStyle: 'custom',
  },
})

defineOptions({
  name: 'RichText',
})

const title = ref('')
const content = ref('')

// 返回上一页
const goBack = () => {
  uni.navigateBack()
}

// 页面加载时获取标题和富文本内容
onLoad((options) => {
  if (options.title) {
    title.value = options.title
  }
  if (options.content) {
    content.value = decodeURIComponent(options.content)
  }
})
</script>

<style scoped>
page {
  background-color: #F1F1F1;
}
</style>
